package com.net.xpay.common.manager.impl.notification;

import com.google.common.base.Preconditions;
import com.net.common.dao.BasicMapper;
import com.net.xpay.common.dao.notification.ReadNotificationMapper;
import com.net.xpay.common.domain.notification.ReadNotification;
import com.net.xpay.common.manager.notification.ReadNotificationManager;
import com.net.common.manager.AbstractManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class ReadNotificationManagerImpl extends AbstractManager<ReadNotification> implements ReadNotificationManager{

    @Autowired
    private ReadNotificationMapper mapper;


    @Override
    protected BasicMapper<Long, ReadNotification> getMapper() {
        return mapper;
    }

    @Override
    public long countByNotificationId(Long userId, Long notificationId) {
        Preconditions.checkArgument(userId != null && notificationId != null);
        ReadNotification condition = new ReadNotification();
        condition.setUserId(userId);
        condition.setNotificationId(notificationId);
        return count(condition);
    }
}
